package com.tz.colawallet.ui.presenter;

import com.tz.colawallet.basecode.base.BaseBiz;
import com.tz.colawallet.basecode.base.BaseRespNew;
import com.tz.colawallet.ui.biz.SuggestBiz;
import com.tz.colawallet.ui.contract.SuggestContract;

import javax.inject.Inject;

/**
 * Created by Administrator on 2017/10/25.
 */

public class SuggestPresenter implements SuggestContract.SuggestPresenter {

    SuggestContract.View view;
    SuggestBiz biz;

    @Inject
    public SuggestPresenter(SuggestContract.View view) {
        this.view = view;
    }


    @Override
    public void setBiz(BaseBiz biz) {
        this.biz = (SuggestBiz) biz;
    }


    @Override
    public void suggest(String content) {
        view.loading(true);
        biz.suggest(view.curContext(), content, new BaseBiz.Callback<BaseRespNew>() {
            @Override
            public void onSuccess(BaseRespNew o) {
                view.loginSuccess(o.getData());
                view.loading(false);
            }

            @Override
            public void onFailure(BaseRespNew o) {
                view.showMsg(o.getMsg());
                view.loading(false);
            }
        });
    }


}
